package com.yk.controller;

import com.sun.org.slf4j.internal.Logger;
import com.sun.org.slf4j.internal.LoggerFactory;
import com.yk.pojo.CommonResult;
import com.yk.pojo.Payment;
import com.yk.service.IPaymentService;
import lombok.RequiredArgsConstructor;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@Slf4j
@RequiredArgsConstructor
public class PaymentController {
    private static final Logger logger = LoggerFactory.getLogger(PaymentController.class);


    private final IPaymentService iPaymentService;


    @RequestMapping("/feign/all")
    public CommonResult all() {
        CommonResult<List<Payment>> all = iPaymentService.all();
        return all;
    }

    @RequestMapping("/feign/create")
    public CommonResult all(Payment payment) {
        CommonResult<Integer> integerCommonResult = iPaymentService.create(payment);
        return integerCommonResult;
    }

    @RequestMapping("/feign/get/{id}")
    public CommonResult all(@PathVariable  Long id) {
        CommonResult<Payment> commonResult = iPaymentService.getById(id);
        return commonResult;
    }

    @GetMapping("/feign/discovery")
    public Object discovery(){
        return iPaymentService.discovery();
    }

    @RequestMapping("/feign/delay")
    public Object delay() {
        return iPaymentService.delay();
    }


}
